﻿using BCCommon.Enums;
using BCEntity.TMS.Agent.AgentRecord;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BCData.TMS.Agent.AgentRecord
{
    /// <summary>
    /// 代理商信息
    /// </summary>
    public interface IAgentRecordData
    {
        /// <summary>
        /// 根据公司ID获取代理商信息
        /// </summary>
        /// <param name="companyId">公司ID</param>
        /// <returns></returns>
        Task<AgentRecordEntity> GetEntityByCompanyId(int companyId);

        /// <summary>
        /// 添加代理商信息
        /// </summary>
        /// <param name="entity">代理商信息</param>
        /// <returns></returns>
        Task<AgentRecordEntity> Insert(AgentRecordEntity entity);

        /// <summary>
        /// 获取代理商信息
        /// </summary>
        /// <param name="agentRecordId">代理商记录Id</param>
        /// <returns></returns>
        Task<AgentRecordEntity> GetEntity(long agentRecordId);

        /// <summary>
        /// 更新代理商信息
        /// </summary>
        /// <param name="entity">代理商信息</param>
        /// <returns></returns>
        Task<AgentRecordEntity> Update(AgentRecordEntity entity);

        /// <summary>
        /// 获取代理商信息
        /// </summary>
        /// <param name="logonCmpanyId">登录人公司ID</param>
        /// <param name="companyId">公司ID</param>
        /// <param name="parentCompanyId">父级公司Id</param>
        /// <param name="agentLevel">代理商级别</param>
        /// <param name="isDelete">是否已删除</param>
        /// <param name="createStartDate">创建开始日期</param>
        /// <param name="createEndDate">创建结束日期</param>
        /// <param name="businessType">公司业务类型</param>
        /// <param name="companyName">公司名称</param>
        /// <param name="pageIndex">页号</param>
        /// <param name="pageSize">每页数据条数</param>
        /// <returns></returns>
        Task<(IEnumerable<AgentRecordViewEntity>, int)> Query(int? logonCmpanyId, int? companyId, int? parentCompanyId, int? agentLevel, bool? isDelete, DateTime? createStartDate, DateTime? createEndDate, CompanyBusinessType? businessType, string companyName, int pageIndex, int pageSize);
        /// <summary>
        /// 获取代理商信息
        /// </summary>
        /// <param name="uniqueCode">唯一码</param>
        /// <returns></returns>
        Task<AgentRecordEntity> GetByUniqueCodeAsync(string uniqueCode);
        /// <summary>
        /// 根据区县编码获取顶级代理商信息
        /// </summary>
        /// <param name="countyCode">区县编码</param>
        /// <returns></returns>
        Task<AgentRecordEntity> GetTopAgentByCountyCode(string countyCode);
        /// <summary>
        ///获取代理商视图信息
        /// </summary>
        /// <param name="agentRecordId">代理商Id</param>
        /// <returns></returns>
        Task<AgentRecordViewEntity> GetViewByAgentRecordIdAsync(long agentRecordId);
    }
}
